package d1_com.itheima.file;

import java.io.File;

public class Test3 {
    public static void main(String[] args) {
        File f1 = new File("C:/Users/23738/Downloads/临时图片");
        File[] files = f1.listFiles();
        int s = 0;
        //遍历文件进行改名
        for (File file : files) {
            s++;
            String name = file.getName();
            String lastName = name.substring(name.indexOf("."));
            String txt = "图片" + Integer.valueOf(s) + lastName;
            file.renameTo(new File(file.getParent(), txt));
        }

    }
}
